package com.wtone.platform.gat.images.gat.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSort;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.wtone.platform.gat.images.gat.model.ApeListObject;
import com.wtone.platform.gat.images.gat.model.ResponseStatusListModeObject;
import com.wtone.platform.gat.images.gat.service.ApesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: aiLin
 * @Date: 2020/10/7 15:28
 * @desc: 采集设备相关接口
 */
@Api(tags = "采集设备相关接口", value = "Apes api")
@ApiSort(6)
@Slf4j
@RestController
public class ApesController {

    @Autowired
    private ApesService apesService;

    @ApiOperation("查询采集设备")
    @ApiOperationSort(value = 1)
    @RequestMapping(value = "/VIID/APEs", method = RequestMethod.GET, produces="application/json")
    public ApeListObject queryApes(
           @RequestParam(name = "ApeID",required = false) String ApeID,
           @RequestParam(name = "Name",required = false) String Name,
           @RequestParam(name = "Model",required = false) String Model,
           @RequestParam(name = "IPAddr",required = false) String IPAddr,
           @RequestParam(name = "Port",required = false) String Port,
           @RequestParam(name = "PlaceCode",required = false) String PlaceCode,
           @RequestParam(name = "IsOnline",required = false) String IsOnline,
           @RequestParam(name = "UserId",required = false) String UserId){
        return apesService.queryApes(ApeID,Name,Model,IPAddr,Port,PlaceCode,IsOnline,UserId);
    }

    @ApiOperation("添加采集设备")
    @ApiOperationSort(value = 2)
    @RequestMapping(value = "/VIID/APEs", method = RequestMethod.POST, produces="application/json")
    public ResponseStatusListModeObject AddApes(@RequestBody ApeListObject apeListObject){
        return apesService.AddApes(apeListObject);
    }

    @ApiOperation("修改采集设备")
    @ApiOperationSort(value = 3)
    @RequestMapping(value = "/VIID/APEs", method = RequestMethod.PUT, produces="application/json")
    public ResponseStatusListModeObject updateApes(@RequestBody ApeListObject apeListObject){
        return apesService.updateApes(apeListObject);
    }
}
